<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo GetLang('imm'); ?></title>
<?php include(DEDEMEMBER."/templets/head_inc.htm"); ?>
<script type="text/javascript">
$(function() {
	$("#navigation .sort").click(function(){
		$(this).next(".menu").toggleClass("invisible");
		$(this).toggleClass("hover");
	})
	///列表
	$("table.list1 tr:even").addClass("even"); //偶行风格
	//点击高亮
	$("table.list1 td").click(function() {
		$(this).parent("tr").toggleClass("click");
		$(this).parent("tr").toggleClass("hover");
	});
	$("table.list1 td").hover(function() {
		$(this).parent("tr").addClass("hover");
	},
	function() {
		$(this).parent("tr").removeClass("hover");
	});
	//点击单元格时该行高亮
	$(".list tbody tr td").click(function(){$(this).parent("tr").toggleClass("click");$(this).parent("tr").toggleClass("hover");	});
	$(".list tbody tr td").hover(function(){$(this).parent("tr").addClass("hover"); },function(){$(this).parent("tr").removeClass("hover"); });
	//checked 全选&反选&单选
	$("#checkedClick").click(function(){
		$("form [name='deleteid']").each(function(){
			if($(this).attr("checked")){
				$(this).removeAttr("checked");
				}
			else{
				$(this).attr("checked",'true');
				}
		})
	});
})
function folderSelAll()
{
	for(i=0;i<document.form1.deleteid.length;i++)
	{
		if(!document.form1.deleteid[i].checked)
		{
			document.form1.deleteid[i].checked=true;
		}
	}
}

//获得选中文件的文件名
function GetCheckfolderItem()
{
	var allSel='';
	if(document.form1.deleteid.value) return document.form1.deleteid.value;
	for(i=0;i<document.form1.deleteid.length;i++)
	{
		if(document.form1.deleteid[i].checked)
		{
			if(allSel=='')
			allSel=document.form1.deleteid[i].value;
			else
			allSel=allSel+","+document.form1.deleteid[i].value;
		}
	}
	return allSel;
}
function DoSubmit(myfolder)
{
	var selid = GetCheckfolderItem();
	if(selid=='') {
		alert("<?php echo GetLang('notselmsg'); ?>");
		return false;
	}
	if(window.confirm("<?php echo GetLang('delselmsg'); ?>"))
	{
		location = "pm.php?dopost=del&ids="+selid+"&folder="+myfolder;
	}
}
</script>
</head>
<body>
<?php include(DEDEMEMBER."/templets/head.htm"); ?>
<div class="wrapper mT10">
  <div class="west">
    <?php include(DEDEMEMBER."/templets/menu.htm"); ?>
  </div>
  <div class="east mL10">
    <div class="heading"><strong class="icon mail mL10" style="width:400px;"><?php echo GetLang('shortmessage'); ?></strong></div>
    <ul class="titleTabBar fLeftChild mT10">
      <li><a href="pm.php?dopost=send"><?php echo GetLang('newmsg'); ?></a></li>
      <li <?php if($folder == "inbox" || empty($folder)) echo 'class="select"'; ?>><a href="pm.php?folder=inbox"><?php echo GetLang('inbox'); ?></a></li>
      <li <?php if($folder == "outbox") echo 'class="select"'; ?>><a href="pm.php?folder=outbox"><?php echo GetLang('outbox'); ?></a></li>
      <li <?php if($folder == "track") echo 'class="select"'; ?>><a href="pm.php?folder=track"><?php echo GetLang('track'); ?></a></li>
    </ul>
    <div class="clear"></div>
    <form class="mTB10 mL10 mR10" action="pm.php" method="post" name="form1">
      <input type='hidden' name='dopost' value='del' />
      <table cellspacing="1" class="list1">
        <thead>
          <tr>
            <th align="left" width="1%"><input name="checkedClick" type="checkbox" value="" id="checkedClick"></th>
            <th ><?php echo GetLang('title'); ?></th>
            <th width="10%"><?php
          	if($folder == "inbox") echo GetLang('senduser');
          	else echo GetLang('getuser');
          	?></th>
            <th width="10%"><?php echo GetLang('state'); ?></th>
            <th width="15%"><?php echo GetLang('time'); ?></th>
          </tr>
        </thead>
        <tbody>
        
        {dede:datalist}
        <tr>
          <td><input type="checkbox" name="deleteid" value="{dede:field.id/}" /></td>
          <td><?php
           if($fields['hasview']==0) echo "<a href='pm.php?dopost=read&id={$fields['id']}'><strong>{$fields['subject']}</strong></a>";
           else echo "<a href='pm.php?dopost=read&id={$fields['id']}'>{$fields['subject']}</a>";
           ?></td>
          <td align="center"><?php  if($folder == "inbox") {  ?>
            <a href="index.php?uid=<?php echo $fields['floginid']; ?>" target="_blank"> <?php echo $fields['floginid']; ?> </a>
            <?php  }else{  ?>
            <a href="index.php?uid=<?php echo $fields['tologinid']; ?>" target="_blank"> <?php echo $fields['tologinid']; ?> </a>
            <?php }  ?></td>
          <td align="center"><?php
          $readmsg = ($fields['hasview']==0 ? "<span style='color:red'>".GetLang('unread')."</span>" : GetLang('hasread'));
          echo $readmsg;
          ?></td>
          <td align="center"><?php
          echo MyDate('y-m-d H:i:s',$fields['sendtime']);
          ?></td>
        </tr>
        {/dede:datalist}
        </tbody>
        
      </table>
      <button class="buttonGary2 fLeft mT10" type="button" onclick="DoSubmit('<?php echo $folder; ?>')"><?php echo GetLang('del'); ?></button>
      <ul class="paglist clear">
        {dede:pagelist listsize=5 /}
      </ul>
    </form>
  </div>
</div>
<div class="clearfix"></div>
<?php include(DEDEMEMBER."/templets/foot.htm"); ?>
</body>
</html>
